﻿@model Yeap.Models.WorkListModel

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    Model.Index = 0;
}

@using Yeap.Kernel.Utils;

@using (Html.BeginForm("Index","Work", FormMethod.Post)){
<div class="formWrapper">
@Html.DropDownList("course", new SelectList(Model.AvailableCourses, "Value", "Name", Model.SelectedCourse), new {@class="filterDropdown" })
@Html.DropDownList("year", new SelectList(Model.AvailableYears, "Value", "Name", Model.SelectedYear), new { @class = "filterDropdown" })
@Html.DropDownList("professor", new SelectList(Model.AvailableProfessors, "Value", "Name", Model.SelectedProfessor), new {@class="filterDropdown" })
@Html.DropDownList("workType", new SelectList(Model.AvailableWorkTypes, "Value", "Name", Model.SelectedWorkType), new {@class="filterDropdown" })

<input type="image" src="../../Content/images/btn-go2.gif" name="submit" class="BtnGo"/>
</div>
}

<table class="BaseTable" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <th class="index">#</th>
            <th>Название работы</th>
            <th>Преподаватель</th>
            <th>Курс</th>
            <th>Год</th>
            <th>Студенты</th>
            <th>Тип работы</th>
            <th>Действия</th>
        </tr>
        @foreach (var workDescriptor in Model.Works)
        {
            <text>
            @{
                 Model.Index = Model.Index +1;
             }
             </text>
            <tr>
              <td>@Model.Index</td>
              <td><a href="@(Url.Action("Show", "Work", new RouteValueDictionary{{"id", workDescriptor.Work.Id}}))">@workDescriptor.WorkTitle</a></td>
              <td>@workDescriptor.Teacher.FullName</td>
              <td>@workDescriptor.Work.Course</td>
              <td>@workDescriptor.Work.Year - @(workDescriptor.Work.Year+1)</td>
              <td>@{
                    Html.RenderAction("GetStudentList", "Work", new { workListModel = Model, workId = Model.Index });
                  }              
              </td>
              <td>@workDescriptor.WorkType.WorkTypeToString()</td>
              <td>Here be dragons</td>
            </tr>
        }
            
    </tbody>
 </table>


 
